package com.example.coffeeseller_2.model.presenter;

import android.content.Context;

import com.example.coffeeseller_2.model.listenner.IUserLogin;
import com.example.coffeeseller_2.model.listenner.OnLoginCallBackListener;
import com.example.coffeeseller_2.model.model.UserLogin;
import com.example.coffeeseller_2.views.viewinterface.Iloginview;


/**
 * Created by Administrator on 2018/3/20.
 */

public class UserLoginPresenter {
    private IUserLogin iUserLogin;
    private Iloginview iLoginview;

    public UserLoginPresenter(Context mContext, Iloginview iLoginview) {
        this.iUserLogin = new UserLogin(mContext);
        this.iLoginview = iLoginview;
    }

    public void PresenterLogin() {
        iUserLogin.login(iLoginview.getUserName(), iLoginview.getPassword(), new OnLoginCallBackListener() {
            @Override
            public void loginSuccess() {
                iLoginview.toSettingFragment();
            }

            @Override
            public void loginFailed(String erro) {
                iLoginview.showFailedError(erro);
            }
        });
    }
}
